package com.liruo.treasureattic.starter.oss;

import com.liruo.treasureattic.starter.oss.client.TencentCloudOssClient;
import com.liruo.treasureattic.starter.oss.model.properties.TencentCloudOssProperties;
import com.qcloud.cos.COSClient;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

/**
 * @Author:liruo
 * @Date:2022-12-05-17:14:58
 * @Desc
 */
@AutoConfiguration
@ConditionalOnClass(COSClient.class)
@EnableConfigurationProperties({TencentCloudOssProperties.class})
public class TencentCloudOssAutoconfiguration {
    private final TencentCloudOssProperties properties;

    public TencentCloudOssAutoconfiguration(TencentCloudOssProperties properties) {
        this.properties = properties;
    }

    @Bean
    public TencentCloudOssClient tencentCloudOssClient(){
        return new TencentCloudOssClient(properties);
    }
}
